﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DiscreteEventModel.Common {

    public class ReadOnlyCollection<T> : IEnumerable<T> {

        private readonly ICollection<T> _rawCollection;

        public ReadOnlyCollection(ICollection<T> collection) {
            this._rawCollection = collection;
        }

        public bool Contains(T item) {
            return this._rawCollection.Contains(item);
        }

        public void CopyTo(T[] array, int arrayIndex) {
            this._rawCollection.CopyTo(array, arrayIndex);
        }

        public int Count {
            get { return this._rawCollection.Count; }
        }

        #region IEnumerable<T> Members

        public IEnumerator<T> GetEnumerator() {
            return this._rawCollection.GetEnumerator();
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
            return this._rawCollection.GetEnumerator();
        }

        #endregion
    }
}
